package com.hfzy.ihk.web.userCenter.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hfzy.ihk.facade.userCenter.entity.UserHasCallLine;
import com.hfzy.ihk.facade.userCenter.enums.CallType;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

public interface UserHasCallLineMapper extends BaseMapper<UserHasCallLine> {
    @Select("select * from user_has_call_line cl where cl.user_id=#{userId} and cl.call_type=#{callType}")
    UserHasCallLine findUserHasCallLineByUserIdAndType(int userId, CallType callType);

    int count(@Param("params") Map<String, Object> params);

    List<UserHasCallLine> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset,
                    @Param("limit") Integer limit);

    @Select("select cl.*,ui.username from user_has_call_line cl inner join user_info ui on ui.id = cl.user_id where cl.id=#{id}")
    UserHasCallLine selectJoinUsernameById(int id);

    @Select("select cl.*,ui.username from user_has_call_line cl inner join user_info ui on ui.id = cl.user_id where cl.user_id=#{userId}")
    List<UserHasCallLine> getUserHasCallLineByUserId(int userId);
}
